Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmtester: do not crash if create_vm returns nullptr #234

Merged
merged 1 commit into from
Apr 24, 2019
Merged

Conversation

axic
Copy link
Member

@axic axic commented Apr 23, 2019

Split off #233.

@axic axic requested a review from chfast April 23, 2019 20:52
@@ -16,6 +16,8 @@ evmc_create_fn create_fn;
std::unique_ptr<evmc_instance, evmc_destroy_fn> create_vm()
{
auto vm = create_fn();
if (vm == nullptr)
return {nullptr, nullptr};
return {vm, vm->destroy};
Copy link
Member Author

@axic axic Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vm->destroy derefs vm even if it is nullptr.

And there is a proper assertion we want to hit in this case: https://github.com/ethereum/evmc/blob/master/test/vmtester/vmtester.hpp#L21

@axic axic mentioned this pull request Apr 23, 2019
@axic axic merged commit 49c6d2c into master Apr 24, 2019
@axic axic deleted the vmtester branch April 24, 2019 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants